package com.ruoyi.bigScreen;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.zzw.LongListDto;
import com.ruoyi.common.core.domain.zzw.TEventManage;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.vo.CountVO;
import com.ruoyi.system.service.ITEventManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 事件Controller
 *
 * @author xbx
 * @date 2023-10-20
 */
@Api(tags = "事件管理")
@RestController
@RequestMapping("/screen/event")
public class ScreenEventManageController extends BaseController {
    @Autowired
    private ITEventManageService tEventManageService;


    @ApiOperation("事件列表")
    @GetMapping("/pageEvent")
    public AjaxResult pageEvent(String districtId) {
        Page<TEventManage> list = tEventManageService.pageEvent(districtId);
        return AjaxResult.success(list);
    }

    @ApiOperation("根据类型查询top3")
    @GetMapping("/listTop3ByType")
    public AjaxResult listTop3ByType(String type) {
        List<TEventManage> list = tEventManageService.listTop3ByType(type);
        return AjaxResult.success(list);
    }


    @ApiOperation("根据地区查询事件列表")
    @GetMapping("/listByRegion")
    public AjaxResult listByRegion(Long districtId) {
        List<TEventManage> list = tEventManageService.listByRegion(districtId);
        return AjaxResult.success(list);
    }

    @ApiOperation("根据事件类型统计")
    @GetMapping("/groupByType")
    public AjaxResult groupByType() {
        List<CountVO> list = tEventManageService.groupByType();
        return AjaxResult.success(list);
    }


}
